#
from typing import Dict
from apps.aks.aks_ds import AksDs

class AksApp(object):
    def __init__(self):
        self.name = 'apps.aks.aks_app.AksApp'

    @staticmethod
    def startup(params:Dict = {}) -> None:
        if params['task'] == 1:
            print(f'获取AKShare日K数据')
            csv_fn = 'work/datas/aks/ak_hfq.csv'
            AksDs.get_daily_k(csv_fn=csv_fn)
        elif params['task'] == 2:
            print(f'将csv转为bin')
            csv_fn = 'work/datas/aks/ak_hfq.csv'
            bin_folder = 'work/datas/aks'
            AksDs.convert_csv_2_bin(csv_fn=csv_fn, bin_folder=bin_folder)
        elif params['task'] == 3:
            print(f'将bin转为pkl')
            bin_folder = 'work/datas/aks'
            pkl_folder = f'{bin_folder}/pkl'
            AksDs.convert_bin_2_pkl(bin_folder=bin_folder, pkl_folder=pkl_folder)